#ifndef __FLUX_OBSERVER_H__
#define __FLUX_OBSERVER_H__

/* Private includes ----------------------------------------------------------*/
#include "foc.h"
#include "main.h"
/* Private define ------------------------------------------------------------*/
/* Private typedef -----------------------------------------------------------*/
typedef struct
{
  float y1;
  float y2;
  float phi_alpha;  
  float phi_beta;   
  float phi_err;

  float x1;
  float x2;
  float d_x1;
  float d_x2;
  float eta_x1;
  float eta_x2;
  // PLL
  float theta;
  float omega;
  float pll_phi_alpha;
  float pll_phi_beta; 
  float theta_err;
  float _sin, _cos;
  float sin_pll, cos_pll;
  float P;
  float I;
  float Kp;
  float Ki;

  float gamma;  // gain
  float Ts;     
  float phi_m_sq; 
  float eangle;     

} FLUX_t;
/* Private extern variables --------------------------------------------------*/
extern FLUX_t flux;
/* Private function declaration ----------------------------------------------*/
void Flux_Init(FLUX_t *flux);
void Flux_Processing(FLUX_t *flux, FOC *foc);
void Flux_PLL_Processing(FLUX_t *flux);
#endif
